<?php
/**
 * Created by PhpStorm.
 * User: nightelf
 * Date: 2020-12-25
 * Time: 10:03
 */

namespace App\Http\Model;


use Illuminate\Support\Facades\DB;

class ApprovalNodeRoleModel
{
    const TABLE = 'approval_node_role';

    public function getRole(array $where)
    {
        return DB::table(self::TABLE)
            ->leftJoin('role as r','r.id','=',self::TABLE.'.roleId')
            ->where($where)
            ->select(self::TABLE.'.*','r.name as roleName')
            ->get()->toArray();
    }

    public function delete(array $where)
    {
        return DB::table(self::TABLE)->where($where)->delete();
    }

    public function insert(array $data)
    {
        return DB::table(self::TABLE)->insert($data);
    }
}